package com.tzvtc.server.account.controller;


import com.github.pagehelper.PageInfo;
import com.tzvtc.server.account.bean.AccountBean;
import com.tzvtc.server.account.service.AccountService;
import com.tzvtc.server.commons.bean.PageRequestBean;
import com.tzvtc.server.commons.bean.ResultBean;
import com.tzvtc.server.students.bean.StudentBean;
import com.tzvtc.server.students.service.StudentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//直接返回页面
//@Controller

//@RestController将方法返回的内容格式化成json字符串
@Slf4j
@RestController
@RequestMapping("account")
public class AccountController {


    private final AccountService accountService;

    public AccountController(AccountService accountService) {
        this.accountService = accountService;
    }


    //服务端返回给客户端状态码、描述信息、数据
    @RequestMapping("login")
    public ResultBean list(@RequestBody AccountBean accountBean) {
        log.info("/student/list, 用户查询参数: {}",accountBean);
        String token = accountService.login(accountBean);
        log.info("/student/list, 用户列表，查询结果: {}", token);
        return ResultBean.success(token);
    }

}
